#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

const int	maxN = 500000 + 10;
const double	eps = 1e-14;

struct	task_t
{
	int	w, v, a, c;
	double	t;
};

struct task_compare_t
{
	bool operator()(const task_t &x, const task_t &y)
	{
		return x.t * y.c < x.c * y.t;
	}
};

typedef multiset<task_t, task_compare_t> task_set_t;

task_t			task[maxN];
task_set_t		remain;
int			N, K, M;

bool	by_start_time(const task_t &x, const task_t &y)
{
	return x.a < y.a;
}

int	main()
{
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; ++i) 
	{
		scanf("%d%d%d%d", &task[i].w, &task[i].v, &task[i].a, &task[i].c);
		task[i].t = (double) task[i].w / task[i].v;
	}

	sort(task, task + N, by_start_time);

	remain.clear();

	double curr_time = -1;
	double answer = 0;
	
	for (int i = 0; i <= N; ++i)
	{
		double min_t;
		double task_time = (i == N) ? 1e10 : task[i].a;
		task_set_t::iterator it, temp;
			
		while (remain.size() && curr_time < task_time - eps) {
			//if (i == N)
			//{
			//	//break;
			//	cout << remain.size() << endl;
			//	for (it = remain.begin(); it != remain.end(); ++it)
			//		cout << it->t << ' '; cout << endl;
			//}
			it = remain.begin();
			min_t = task_time - curr_time;

			for (int i = 0; i < K; ++i)
			{
				if (it == remain.end()) break;
				min_t = min(min_t, it->t);
				++it;
			}

			curr_time += min_t;
			it = remain.begin();
//			printf("min_t = %.4lf\n", min_t);
			vector<task_t> backup;

			for (int i = 0; i < K; ++i)
			{
				if (it == remain.end()) break;
				temp = it; ++temp;
				backup.push_back(*it);
				backup.back().t -= min_t;
				remain.erase(it);
				it = temp;
			}

			for (int i = 0; i < backup.size(); ++i) 
				if (backup[i].t > eps)
				{
					remain.insert(backup[i]);
				} else
				{
					answer += (curr_time - backup[i].a) * backup[i].c;
				}
		}

		if (i == N) break;

		curr_time = task_time;
		remain.insert(task[i]);
	}

	double total_c = 0;
	for (int i = 0; i < N; ++i) total_c += task[i].c;
	printf("%.10lf\n", answer / total_c);
	getc(stdin);
	return 0;
}

